<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('薪资结构列表')" />
    <th:block th:include="include :: bootstrap-fileinput-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>员工姓名：</label>
                                <input type="text" name="empName"/>
                            </li>
                            <div th:include="include/deptSearch::deptSearch"></div>
                            <li>
                                <label>岗位：</label>
                                <select id="postId" class="form-control m-b" name="postId" th:with="postAll=${@postService.getPostAll()}">
                                    <option value="">所有</option>
                                    <option th:each="post : ${postAll}" th:text="${post.getPostName()}" th:value="${post.getPostId()}"  th:hidden="${post.getStatus() == '1'}"></option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label >入职日期: </label>
                                <div class="layui-input-inline">
                                    <input type="text" class="time-input" placeholder="开始时间" name="startNonManagerDate"/>
                                    <span>-</span>
                                    <input type="text" class="time-input" placeholder="结束时间" name="endNonManagerDate"/>
                                </div>
                            </li>

                            <li class="select-time">
                                <label >上次调薪日期: </label>
                                <div class="layui-input-inline">
                                    <input type="text" name="startAdjustDate" class="time-input" placeholder="开始时间">
                                    <span>-</span>
                                    <input type="text" name="endAdjustDate" class="time-input" placeholder="结束时间">
                                </div>
                            </li>

                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group" >
                <!--<a class="btn btn-success" onclick="$.modal.openMain('薪资调整流程', '/hr/salaryStructure/salaryStructureProcess',($(window).width() - 50),($(window).height() - 50));">
                    <i class="fa fa-plus"></i> 薪资调整流程
                </a>
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="hr:salaryStructure:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="hr:salaryStructure:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="hr:salaryStructure:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="hr:salaryStructure:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="hr:salaryStructure:export">
                    <i class="fa fa-download"></i> 导出
                </a>-->
               <!-- <a class="btn btn-info" onclick="openUpload()" shiro:hasPermission="hr:salaryStructure:export">
                    <i class="fa fa-upload"></i> 导入
                </a>-->
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
     <!-- 导入区域 -->
     <div class="container-div" id="hiddenDiv" style="display: none;" >
         <div class="row">
             <form class="form-horizontal m" id="form-toolRepeal">
                 <div class="ibox-content">
                     <div class="form-group">
                         <label class="font-noraml">文件上传</label>
                         <div class="file-loading">
                             <input id="fileinput" name="files" class="file" type="file" multiple data-min-file-count="1" data-theme="fas">
                             <input type="hidden" id="month">
                         </div>
                     </div>
                 </div>
             </form>
         </div>
     </div>
    <th:block th:include="include :: footer" />
     <th:block th:include="include :: bootstrap-fileinput-js" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('hr:salaryStructure:edit')}]];
        // var removeFlag = [[${@permission.hasPermi('hr:salaryStructure:remove')}]];
        var prefix = ctx + "hr/salaryStructure";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "薪资结构",
                columns: [
                {
                    field: 'id',
                    title: '薪资结构',
                    visible: false
                },
                {
                    field: 'empId',
                    title: '员工id',
                    visible: false
                },
                {
                    field: 'monthDate',
                    title: '月份',
                    visible: false
                },
                {
                    field: 'nonManagerDate',
                    title: '入职时间'
                },
                {
                    field: 'empName',
                    title: '员工'
                },
                {
                    field: 'count',
                    title: '已调薪次数'
                },
                {
                    field: 'adjustDate',
                    title: '上次调薪时间'
                },
                {
                    field: 'postName',
                    title: '岗位'
                },
                {
                    field: 'payGrade',
                    title: '薪酬等级'
                },
                {
                    field: 'comprehensive',
                    title: '综合薪资'
                },
                {
                    field: 'basic',
                    title: '基本工资'
                },
                {
                    field: 'performanceBonus',
                    title: '绩效工资基数'
                },
                {
                    field: 'overtimePay',
                    title: '加班费'
                },
                {
                    field: 'allowance',
                    title: '岗位补贴'
                },
                {
                    field: 'otherSubsidies',
                    title: '其他补贴'
                },

                {
                    field: 'remark',
                    title: '备注'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="operateEdit(\'' + row.id + '\',\'' + row.auditFlag + '\',1000)"><i class="fa fa-edit"></i>调整薪资</a> ');
                        actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="operateInfoList(\'' + row.empId + '\')"><i class="fa fa-edit"></i>调薪记录</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);

            layui.use('laydate', function(){
                var laydate = layui.laydate;
                //年月选择器
                laydate.render({
                    elem: '#test3'
                    ,type: 'month'
                });
            });

        });

        function operateEdit(id, auditFlag, w) {

            // if (auditFlag == 1){
            //     $.modal.alertWarning("有正在审批的薪资调整申请，不能重复提交！");
            //     return;
            // }

            $.operate.edit(id,w);
        }

        function operateInfoList(empId) {
            var url = prefix + "/infoView/"+empId+"";
            $.modal.open("调薪记录", url,'1000');
        }

    </script>
</body>
</html>